﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Business.DataBusiness;

namespace MuaBanDT
{
    public partial class DangNhap : Form
    {   
        Form QuanLy = new QuanLy();
        MainForm mainForm = new MainForm();
        public DangNhap()
        {
            InitializeComponent();
        }

        private void btnDangNhap_MouseHover(object sender, EventArgs e)
        {
            this.btnDangNhap.FlatStyle = FlatStyle.Standard;
        }

        private void btnDangNhap_MouseLeave(object sender, EventArgs e)
        {
            this.btnDangNhap.FlatStyle = FlatStyle.Flat;
        }

        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            DangNhapMK a = new DangNhapMK();
            a.UserName = this.tBoxUser.Text;
            a.Pass = this.tBoxPass.Text;
            if(a.DangNhap() > 0)
            {
                this.Hide();
                mainForm.Hide();
                QuanLy.ShowDialog();
            }
            else
                MessageBox.Show("Bạn đã nhập sai mật khẩu hoặc tên", "Đăng Nhập", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);
        }

        private void DangNhap_Load(object sender, EventArgs e)
        {
            this.tBoxUser.Text = "ad";
            this.tBoxPass.Text = "ad";
        }

    }
}
